<html>
<head>
<title>Edit a record of 用戶已申請產品</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link media="all" href="/cms/css/cms.min.css" type="text/css" rel="stylesheet" /> 
<link rel="stylesheet" type="text/css" href="/cms/css/tag/token-input.css" />
<script  type="text/javascript" src="/cms/js/cms.1.1.min.js"></script>
<script type="text/javascript" src="/cms/js/tag/jquery.tokeninput.js"></script>
<script language="JavaScript" src="/cms/js/cleditor/jquery.cleditor.min.js"></script>
<!--change to auto add JS later-->
<script language="JavaScript" src="/cms/js/jquery.validate.js"></script>
<script language="JavaScript" src="/cms/js/autocomplete/textarea.js"></script>

<link media="all" href="/cms/js/jcrop/css/jquery.Jcrop.css" type="text/css" rel="stylesheet"> 
</head>

<body>
{#include file="$navigation"#}
<div style="float:right;" id="login"></div>
<script>
$(document).ready(function() {	

});	
  function validate_form(form){
	  if (validator.form())  form.submit(); else alert('Some fields has error. Please check and resubmit');
  }
</script>

<H1><span id="parent_key_label"></span>Edit a record of  用戶已申請產品</H1>
<form name="form_edit" id="form_edit" method="post" action="{#$self_url#}" >	
<div class='tableWrapper' style="width:100%;margin:0;padding:0;">
  <div class='tableHeader' >

	<ul class="tableActions">
	
  <li><input class="psbutton" onmouseover="this.className='psbuttonhover'" onmouseout="this.className='psbutton'" name="Submit" value=" 儲存 " onclick="form.subaction.value='edit_after_update'; form.submit();" type="button"></li>
  <li><input class="psbutton" onmouseover="this.className='psbuttonhover'" onmouseout="this.className='psbutton'" type="submit" name="Submit" value=" 確定 "></li>
  <li><input class="psbutton" onmouseover="this.className='psbuttonhover'" onmouseout="this.className='psbutton'" name="dummy" value=" 取消 " onclick="javascript:window.location.href='{#$self_url#}/list'" type="button"></li>  
<li><input class="psbutton" onmouseover="this.className='psbuttonhover'" onmouseout="this.className='psbutton'" name="Submit" value=" 刪除 " onclick="form.action.value='del'; form.submit();" type="button"></li>
	</ul>

  <div class='clear'></div>
  <div class='corner left'></div>
  <div class='corner right'></div>
  </div>	
	
<table border="0" cellspacing='0' >
<tr id="tr_id"><td><B>id</B></td>
<td id="td_id">{#$edit_data.id#}</td></tr>
<tr id="tr_mid"><td><B>會員編號</B></td>
<td id="td_mid"><input id="field_mid" type="text" name="mid" value="{#$edit_data.mid#}"></td></tr>
<tr id="tr_product"><td><B>產品編號</B></td>
<td id="td_product"><input id="field_product" type="text" name="product" value="{#$edit_data.product#}"></td></tr>
<tr id="tr_product_experience_reports_comment"><td><B>product_experience_reports_comment</B></td>
<td id="td_product_experience_reports_comment"><input id="field_product_experience_reports_comment" type="text" name="product_experience_reports_comment" value="{#$edit_data.product_experience_reports_comment#}"></td></tr>
<tr id="tr_delivery_status"><td><B>送貨狀態</B> <img src="/cms/images/ico/info.gif" class="tips" title="未發貨  備貨中 已發貨 已收貨等" /></td>
<td id="td_delivery_status">{#$edit_data.delivery_status#}</td></tr>
<tr id="tr_express_num"><td><B>快遞和單號</B></td>
<td id="td_express_num"><input id="field_express_num" type="text" name="express_num" value="{#$edit_data.express_num#}"></td></tr>
<tr id="tr_send_time"><td><B>發貨時間</B></td>
<td id="td_send_time"><input type="text" name="send_time" value="{#$edit_data.send_time#}" id="datepicker_send_time">
<script type="text/javascript">  
$(function() {  
    $('#datepicker_send_time').datepicker({  
        duration: '',  
        showTime: true,  
        constrainInput: false,  
        stepMinutes: 1,  
        stepHours: 1,          
        altTimeField: '',  
        dateFormat:'yy-mm-dd',
        time24h: true  
     });  
});  
</script>

</td></tr>
<tr id="tr_message"><td><B>備註內容</B></td>
<td id="td_message"><input id="field_message" type="text" name="message" value="{#$edit_data.message#}"></td></tr>
<tr id="tr_report_endtime"><td><B>報告結束提交時間</B></td>
<td id="td_report_endtime"><input type="text" name="report_endtime" value="{#$edit_data.report_endtime#}" id="datepicker_report_endtime">
<script type="text/javascript">  
$(function() {  
    $('#datepicker_report_endtime').datepicker({  
        duration: '',  
        showTime: true,  
        constrainInput: false,  
        stepMinutes: 1,  
        stepHours: 1,          
        altTimeField: '',  
        dateFormat:'yy-mm-dd',
        time24h: true  
     });  
});  
</script>

</td></tr>
<tr id="tr_is_express_delay"><td><B>快遞延遲</B> <img src="/cms/images/ico/info.gif" class="tips" title="1：快遞延遲 0：快遞沒有延遲" /></td>
<td id="td_is_express_delay">{#$edit_data.is_express_delay#}</td></tr>
<tr id="tr_express_delay_reason"><td><B>快遞延遲原因</B></td>
<td id="td_express_delay_reason">{#$edit_data.express_delay_reason#}</td></tr>
<tr id="tr_express_delay_remark"><td><B>快遞延遲備註</B></td>
<td id="td_express_delay_remark"><textarea name="express_delay_remark" id="field_express_delay_remark" cols="80" rows="2">{#$edit_data.express_delay_remark#}</textarea></td></tr>
<tr id="tr_is_member_delay"><td><B>會員延遲</B> <img src="/cms/images/ico/info.gif" class="tips" title="1：會員延遲 0：會員沒有延遲" /></td>
<td id="td_is_member_delay">{#$edit_data.is_member_delay#}</td></tr>
<tr id="tr_is_submitted"><td><B>是否已經提交報告</B></td>
<td id="td_is_submitted">{#$edit_data.is_submitted#}</td></tr>
<tr id="tr_addedby"><td><B>建立者</B></td>
<td id="td_addedby">{#$edit_data.addedby#}</td></tr>
<tr id="tr_modifiedby"><td><B>更新者</B></td>
<td id="td_modifiedby">{#$edit_data.modifiedby#}</td></tr>
<tr id="tr_approvedby"><td><B>審核者</B></td>
<td id="td_approvedby">{#$edit_data.approvedby#}</td></tr>
<tr id="tr_status"><td><B>上線狀態</B></td>
<td id="td_status">{#$edit_data.status#}</td></tr>
<tr id="tr_addtime"><td><B>建立時間</B></td>
<td id="td_addtime">{#$edit_data.addtime#}</td></tr>
<tr id="tr_lastmodify"><td><B>更新時間</B></td>
<td id="td_lastmodify">{#$edit_data.lastmodify#}</td></tr>
  <tr>
    <td>&nbsp;</td>
    <td><input type="hidden" name="id" value="{#$edit_data.id#}">
     	
    <input type="hidden" name="action" value="update"><input name="subaction" type="hidden">
	<ul class="tableActions">
    
  <li><input class="psbutton" onmouseover="this.className='psbuttonhover'" onmouseout="this.className='psbutton'" name="Submit" value=" 儲存 " onclick="form.subaction.value='edit_after_update'; form.submit();" type="button"></li>
  <li><input class="psbutton" onmouseover="this.className='psbuttonhover'" onmouseout="this.className='psbutton'" type="submit" name="Submit" value=" 確定 "></li>
  <li><input class="psbutton" onmouseover="this.className='psbuttonhover'" onmouseout="this.className='psbutton'" name="dummy" value=" 取消 " onclick="javascript:window.location.href='{#$self_url#}/list'" type="button"></li>  
<li><input class="psbutton" onmouseover="this.className='psbuttonhover'" onmouseout="this.className='psbutton'" name="Submit" value=" 刪除 " onclick="form.action.value='del'; form.submit();" type="button"></li>
	</ul>
  </td>
  </tr>
</table>

</form> 

<script type="text/javascript">
$(function(){
  $(".tips").tipTip({defaultPosition: "right", edgeOffset: 10});
});
</script>

<script type="text/javascript">
function hidden_rows_by_type(type){

  var myArray = [
		[] ,
		[] ,
		[] ,
		[] ,
		['express_delay_remark'] ,
  ];

  for (var i=0; i<myArray.length; i++) {
    if (type == i + 1){
       for (var j=0; j<myArray[i].length; j++){
         $('#tr_'+myArray[i][j]).show();
       }
    } else {
       for (var j=0; j<myArray[i].length; j++){
        $('#tr_'+myArray[i][j]).hide();
       }
    }
  }
}

$(document).ready(function() {	

   var fieldname = 'express_delay_reason';

	var type = parseInt($('[name="'+fieldname+'"]').val());
console.log(type );
	hidden_rows_by_type(type);

	$('[name="'+fieldname+'"]').change(function() {
		hidden_rows_by_type(parseInt($(this).val()));
	});

});

</script>
<!--POSTRUNJS-->
</body>
</html>
